import java.util.Scanner;

public class test {
    public static void hanoi(int x, char pos1, char pos2, char pos3){
        if(x == 1){
            System.out.println("Move disk 1 from " + pos1 + " to " + pos3);
        }
        else{
            hanoi(x-1, pos1, pos3, pos2);
            System.out.println("Move disk " + x + " from " + pos1 + " to " + pos3);
            hanoi(x-1, pos2, pos1, pos3);
        }
    }
    public static void main(String[] args) {
        System.out.println("请输入要移动的汉诺塔的层数:");
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        hanoi(n, 'A','B', 'C');
    }
}